package socket;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class HwCC08Server {

	public static void main(String[] args) {
		try {
			ServerSocket socket = new ServerSocket(6789);
			Socket client = socket.accept();
			BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
			PrintWriter out = new PrintWriter(client.getOutputStream());
			int i = 0;
			while (true) {
				i++;
				//String str = in.readLine();
				//System.out.println(str);
				out.println(i + "-----has received ...  fdsfsdfs[]fefefefefe ---END");
				out.flush();
				//if ("end".equals(str)) {
				//	break;
				//}
				if (i > 10000)
					break;
			}
			//client.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
